<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
	<!-- 
	 -->
<head th:replace="dashboard/header :: header"></head>

<div th:replace="dashboard/script:: style"></div>
<style>
      .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
      article {max-width: 100%;}
</style>

<body>


	<!--
@desc  添加
@author WeiXiaoJin
@since 2019-11-21 07:41:47
-->
<article >
<h2>压测脚本(Scala)</h2>

<form >
<textarea id="code" name="code" style="height:700px">
#include "syscalls.h"
/* getchar:  simple buffered version */
int getchar(void)
{
static char buf[BUFSIZ];
static char *bufp = buf;
static int n = 0;
if (n == 0) {  /* buffer is empty */
n = read(0, buf, sizeof buf);
bufp = buf;
}
return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
}
</textarea>
</form> 
<div style="font-size: 13px; width: 300px; height: 30px;">Key buffer: <span id="command-display"></span></div>

<script> 
CodeMirror.commands.save = function() {
    alert("Saving");
};
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
    lineNumbers: true,
    mode: "text/x-csrc",
    keyMap: "vim",
    matchBrackets: true,
    showCursorWhenSelecting: true,
    inputStyle: "contenteditable"
});
editor.setSize('auto','500px');
var commandDisplay = document.getElementById('command-display');
var keys = '';
CodeMirror.on(editor, 'vim-keypress',
function(key) {
    keys = keys + key;
    commandDisplay.innerHTML = keys;
});
CodeMirror.on(editor, 'vim-command-done',
function(e) {
    keys = '';
    commandDisplay.innerHTML = keys;
}); 
</script>

</article>
</body>
</html>


